<%-- 
    Document   : BanksList
    Created on : 16/Jan/2010, 11:53:47
    Author     : mario
--%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${requestScope['title']} - ${requestScope['action']}</title>
        <style type="text/css">
            body { font-family: Verdana, sans-serif; font-size:80%}
            table {
                border-color:black;
                border-style:solid;
                border-width:thin;
                padding:0;
                margin:0;
            }
            tr.l1 {
                background:lightblue;
                padding:0;
                margin:0;
            }
            tr.l2 {
                padding:0;
                margin:0;
            }
        </style>
    </head>
    <body>
        <h1>${requestScope['title']} - ${requestScope['action']}</h1>
        <c:choose>
            <c:when test="${!empty requestScope['collection']}">
                <form action="?" method="POST">
                    <input type="hidden" name="id" value="" />
                    <table>
                        <thead>
                            <tr>
                                <th>Código</th>
                                <th>Nome</th>
                                <th>Iniciais</th>
                                <th>Nome do responsável</th>
                                
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach var="bank" items="${requestScope['collection']}" varStatus="loop">
                                <tr class="${loop.index % 2 == 0 ? 'l1' : 'l2'}">
                                    <td>${bank.code}</td>
                                    <td>${bank.name}</td>
                                    <td>${bank.shortName}</td>
                                    <td>${bank.responsibleName}</td>
                                    <td><input type="button" value="Consultar" onclick="this.form.action='?action=detail'; this.form.id.value=${bank.id}; this.form.submit();"/></td>
                                </tr>
                            </c:forEach>
                        </tbody>
                        <tr>
                            <td><input type="button" value="Adicionar" onclick="this.form.action='bank?action=new';this.form.submit();"> </td>
                        </tr>
                    </table>

                </form>
            </c:when>
            <c:otherwise>
                <div><span>Não existem bancos. <a href="bank?action=new">Adicionar banco</a></span></div>
            </c:otherwise>
        </c:choose>
    </body>
</html>
